<template>
	<el-card class="box-cards fit" style="height: 250px;overflow-y: scroll;">
		<div slot="header">
			<span>维系记录</span>
		</div>
		<audio controls="controls" src="" id="recordPlayId" style="display:none"></audio>

		<el-row class="bborder" v-for="item in hisConcatGrid">
			<el-col :span="8" class="scolor">{{moment(Number(item.createTime)).format("HH:mm:ss")}}
				<br />
				<span cclass="fcolor" style="color: rgb(27,159,135);">{{moment(Number(item.createTime)).format("YYYY-MM-DD")}}</span>
				<el-button type="success" v-if="item.recordPatha !=''" @click='playVoice(item.recordPatha)'>
					有录音
				</el-button>
			</el-col>
			<el-col :span="16" class="pag">
				<span class="ccolor">{{item.title}}
					<br /> 客户经理: &nbsp;{{item.uName}}</span>
				<br />
				<span class="concolor">&nbsp;{{item.content}}</span>
			</el-col>
		</el-row>
	</el-card>
</template>

<script>
export default {
  name: "hisConcat",
  componentName: "hisConcat",
  data: function() {
    return {
      //历史维系表单
      hisConcatGrid: []
    };
  },
  props: {
    vin: "",
    change: 0,
    companyId: ""
  },
  watch: {
    vin: function(vin) {
      debugger;
      //				/alert("j");
      this.queryConcatGrid();
    },
    change: function() {
      //alert("i");
      this.queryConcatGrid();
    }
  },
  methods: {
    /*播放录音*/
    playVoice: function(recordPath) {
      debugger;
      if (recordPath == null || recordPath == "") {
        return;
      }
      var audioPlay2 = document.getElementById("recordPlayId");

      audioPlay2.style.display = "block";
      audioPlay2.src = recordPath;
      audioPlay2.play();
    },
    /*************点开任务后，获取已有的维系记录列表**********/
    queryConcatGrid: function() {
      this.$http({
        method: "GET",
        url: this.API_ROOT + "/crm/contact/info",
        params: {
          //plateNum: this.$data.concatForm.plateNum,
          vin: this.vin,
          companyId: this.companyId
        }
      }).then(
        function(resp) {
          //success
          //debugger;
          this.$data.hisConcatGrid = resp.data.dataList;
          var audioPlay2 = document.getElementById("recordPlayId");

          audioPlay2.style.display = "none";
          audioPlay2.src = "";
          audioPlay2.pause();
        },
        function(error) {
          //error
        }
      );
    }
  },
  created: function() {
    this.queryConcatGrid();
  }
};
</script>

<style>

</style>